Inferences - So here Inferences will come
Forest Net Area Sown
71.60 140.98
Other Uncultivated land excluding Fallow land
26.11 25.18
Area not available for cultivation
43.53
function (parts, rows = 10, keep = TRUE, xlab = NULL, title = NULL,
colors = NA, size = 2, flip = FALSE, reverse = FALSE, equal = TRUE,
pad = 0, use_glyph = FALSE, glyph_size = 12, legend_pos = "right")
{
part_names <- names(parts)
if (length(part_names) < length(parts)) {
part_names <- c(part_names, LETTERS[1:length(parts) -
length(part_names)])
}
names(parts) <- part_names
if (all(is.na(colors)))
colors <- suppressWarnings(brewer.pal(length(parts),
"Set2"))
parts_vec <- unlist(sapply(1:length(parts), function(i) {
rep(names(parts)[i], parts[i])
}))
if (reverse)
parts_vec <- rev(parts_vec)
dat <- expand.grid(y = 1:rows, x = seq_len(pad + (ceiling(sum(parts)/rows))))
dat$value <- c(parts_vec, rep(NA, nrow(dat) - length(parts_vec)))
if (!inherits(use_glyph, "logical")) {
fontlab <- rep(fa_unicode[use_glyph], length(unique(parts_vec)))
dat$fontlab <- c(fontlab[as.numeric(factor(parts_vec))],
rep(NA, nrow(dat) - length(parts_vec)))
}
dat$value <- ifelse(is.na(dat$value), " ", dat$value)
if (" " %in% dat$value)
part_names <- c(part_names, " ")
if (" " %in% dat$value)
colors <- c(colors, "#00000000")
dat$value <- factor(dat$value, levels = part_names)
gg <- ggplot(dat, aes(x = x, y = y))
if (flip)
gg <- ggplot(dat, aes(x = y, y = x))
gg <- gg + theme_bw()
if (inherits(use_glyph, "logical")) {
gg <- gg + geom_tile(aes(fill = value), color = "white",
size = size)
gg <- gg + scale_fill_manual(name = "", values = colors,
label = part_names, na.value = "white", drop = !keep)
gg <- gg + guides(fill = guide_legend(override.aes = list(colour = "#00000000")))
gg <- gg + theme(legend.background = element_rect(fill = "#00000000",
color = "#00000000"))
gg <- gg + theme(legend.key = element_rect(fill = "#00000000",
color = "#00000000"))
}
else {
if (choose_font("FontAwesome", quiet = TRUE) == "") {
stop("FontAwesome not found. Install via: https://github.com/FortAwesome/Font-Awesome/tree/master/fonts",
call. = FALSE)
}
suppressWarnings(suppressMessages(font_import(system.file("fonts",
package = "waffle"), recursive = FALSE, prompt = FALSE)))
if (!(!interactive() || stats::runif(1) > 0.1)) {
message("Font Awesome by Dave Gandy - http://fontawesome.io")
}
gg <- gg + geom_tile(color = "#00000000", fill = "#00000000",
size = size, alpha = 0, show.legend = FALSE)
gg <- gg + geom_point(aes(color = value), fill = "#00000000",
size = 0, show.legend = TRUE)
gg <- gg + geom_text(aes(color = value, label = fontlab),
family = "FontAwesome", size = glyph_size, show.legend = FALSE)
gg <- gg + scale_color_manual(name = "", values = colors,
labels = part_names, drop = !keep)
gg <- gg + guides(color = guide_legend(override.aes = list(shape = 15,
size = 7)))
gg <- gg + theme(legend.background = element_rect(fill = "#00000000",
color = "#00000000"))
gg <- gg + theme(legend.key = element_rect(color = "#00000000"))
}
gg <- gg + labs(x = xlab, y = NULL, title = title)
gg <- gg + scale_x_continuous(expand = c(0, 0))
gg <- gg + scale_y_continuous(expand = c(0, 0))
if (equal)
gg <- gg + coord_equal()
gg <- gg + theme(panel.grid = element_blank())
gg <- gg + theme(panel.border = element_blank())
gg <- gg + theme(panel.background = element_blank())
gg <- gg + theme(panel.spacing = unit(0, "null"))
gg <- gg + theme(axis.text = element_blank())
gg <- gg + theme(axis.title.x = element_text(size = 10))
gg <- gg + theme(axis.ticks = element_blank())
gg <- gg + theme(axis.line = element_blank())
gg <- gg + theme(axis.ticks.length = unit(0, "null"))
gg <- gg + theme(plot.title = element_text(size = 18))
gg <- gg + theme(plot.background = element_blank())
gg <- gg + theme(panel.spacing = unit(c(0, 0, 0, 0), "null"))
gg <- gg + theme(legend.position = legend_pos)
gg
}
<bytecode: 0x000000002a96f228>
<environment: namespace:waffle>